package timer;

import java.text.SimpleDateFormat;
import java.util.TimerTask;

public class ExecTask2 extends TimerTask {
    private int counter;
    private SimpleDateFormat sf;

    public ExecTask2(int counter) {
        this.counter = counter;
    }

    @Override
    public void run() {
        counter++;
        sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println("time"+counter+":"+sf.format(System.currentTimeMillis()));
    }
}
